package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseListener;

import model.Model;

public class MainMenuOverlay extends Overlay {

	
	private final int buttonWidth = 100;
	private final int buttonHeight = 30;
	
	private MouseListener summonerListener;
	private MouseListener smasherListener;
	private MouseListener sneakListener;
	
	public MainMenuOverlay(Dimension size) {
		super(size);
	}

	public void setSummonerListener(MouseListener summonerListener) {
		this.summonerListener = summonerListener;
	}


	public void setSmasherListener(MouseListener smasherListener) {
		this.smasherListener = smasherListener;
	}


	public void setSneakListener(MouseListener sneakListener) {
		this.sneakListener = sneakListener;
	}

	@Override
	protected void drawOverlay(Graphics g) {
		super.removeAllButtons();//remove previous buttons
		drawBackground(g);//draw the background
		
		GameButton b = new GameButton("SummonerButton", new Rectangle(new Point(100, 100), 
				new Dimension(buttonWidth, buttonHeight) ),
				ModelToImage.getImage("SummonerButton"));
		b.attachListener( this.summonerListener );
		super.addButton(b);
		
		GameButton b2 = new GameButton("SmasherButton", new Rectangle(new Point(100, 150), 
				new Dimension(buttonWidth, buttonHeight) ),
				ModelToImage.getImage("SmasherButton"));
		b2.attachListener( this.smasherListener);
		super.addButton(b2);
		
		GameButton b3 = new GameButton("SneakButton", new Rectangle(new Point(100, 200), 
				new Dimension(buttonWidth, buttonHeight) ),
				ModelToImage.getImage("SneakButton"));
		b3.attachListener( this.sneakListener );
		super.addButton(b3);
	}

	private void drawBackground(Graphics g) {
		Color c = g.getColor();
		g.setColor(Color.GRAY);
		g.fillRect(0, 0, super.getOuterDimension().width, super.getOuterDimension().height);
		g.setColor( c );
	} 
	
	@Override
	protected void onResize() {}

	@Override
	public void update(Model m) {}

}
